<?php
namespace app\crm\controller;
use think\Loader;

class Reportmanager extends CrmController
{
    /**
     * 加载performanceReport模板
     */
    public function performanceReport()
    {
        //分配增删改的权限
        $menuname = "Performance Report";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname];	
        $this->assign("username",$_SESSION['user_info']['username']);
        $this->assign("priv",$priv);

        $arrUsers = Loader::model('Users')->getUsersList();
        $this->assign("arrUsers",$arrUsers);

        $result = Loader::model('Department')->recursionDepartment();
        $result = Loader::model('Department')->recursionDepartmentArr($result);
        $this->assign('options', $result);

        // 模板输出
        return $this->fetch('performanceReport');
    }


    public function performanceReportData()
    {
        $arrData = Loader::model('Reportmanager')->performanceReportData();
        echo json_encode($arrData);
    }


    /**
     * 加载performanceReport模板
     */
    public function deptPerformanceReport()
    {
        //分配增删改的权限
        $menuname = "Dept Performance Report";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname]; 
        $this->assign("username",$_SESSION['user_info']['username']);
        $this->assign("priv",$priv);

        $arrUsers = Loader::model('Users')->getUsersList();
        $this->assign("arrUsers",$arrUsers);

        $result = Loader::model('Department')->recursionDepartment();
        $result = Loader::model('Department')->recursionDepartmentArr($result);
        $this->assign('options', $result);

        // 模板输出
        return $this->fetch('deptPerformanceReport');
    }


    public function deptPerformanceReportData()
    {
        $arrData = Loader::model('Reportmanager')->deptPerformanceReportData();
        echo json_encode($arrData);
    }


    /**
     * 加载performanceReport模板
     */
    public function conversationReport()
    {
        //分配增删改的权限
        $menuname = "Conversation Report";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname]; 
        $this->assign("username",$_SESSION['user_info']['username']);
        $this->assign("priv",$priv);

        $arrUsers = Loader::model('Users')->getUsersList();
        $this->assign("arrUsers",$arrUsers);

        $result = Loader::model('Department')->recursionDepartment();
        $result = Loader::model('Department')->recursionDepartmentArr($result);
        $this->assign('options', $result);

        // 模板输出
        return $this->fetch('conversationReport');
    }


    public function conversationReportData()
    {
        $arrData = Loader::model('Reportmanager')->conversationReportData();
        echo json_encode($arrData);
    }


    /**
     * 加载recordEvaluationReport模板
     */
    public function recordEvaluationReport()
    {
        //分配增删改的权限
        $menuname = "Record Evaluation Report";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname]; 
        $this->assign("username",$_SESSION['user_info']['username']);
        $this->assign("priv",$priv);

        $arrUsers = Loader::model('Users')->getUsersList();
        $this->assign("arrUsers",$arrUsers);

        $result = Loader::model('Department')->recursionDepartment();
        $result = Loader::model('Department')->recursionDepartmentArr($result);
        $this->assign('options', $result);

        // 模板输出
        return $this->fetch('recordEvaluationReport');
    }


    public function recordEvaluationReportData()
    {
        
    }



}

?>